package route

import (
	"go-gin-api/app/controller"
	"go-gin-api/app/middleware"

	"github.com/gin-gonic/gin"
)

// ArticleRouter 文章相关
func ArticleRouter(r *gin.Engine) {
	articleRouter := r.Group("/article")
	{
		// 获取全部文章
		articleRouter.POST("/list", controller.GetArticleList)
		// 获取文章分类
		articleRouter.POST("/types", controller.GetTypeList)
		// 根据id获取文章
		articleRouter.GET("/detail", controller.GetArticleByID)
		// 获取标签云
		articleRouter.GET("/words", controller.GetWords)
		auth := articleRouter.Group("")
		auth.Use(middleware.AuthRequired())
		{
			// 创建文章接口
			auth.POST("/addArticle", controller.AddArticle)
			// 删除文章
			auth.GET("/deleteArticle", controller.DeleteArticle)
			// 添加文章分类
			auth.POST("/addType", controller.AddTypes)
		}
	}
}
